﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 只读结构
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Dimensions dimensions = new Dimensions();
            Console.WriteLine(dimensions.Length);
         //   dimensions.Length = 77;//报错  错误 CS0200  无法为属性或索引器“Dimensions.Length”赋值 - 它是只读的
          
            Dimensions2 dimensions2 = new Dimensions2();
            Console.WriteLine("dimensions2.Length:" + dimensions2.Length);
            dimensions2.Length = 77;
            Console.WriteLine(dimensions2.Length);
            Dimensions2 dimensions3 = new Dimensions2();
            Console.WriteLine("dimensions3.Length:"+dimensions3.Length);
            dimensions3.Length = 88;
            Console.WriteLine(dimensions3.Length);
            Console.WriteLine("dimensions2.Lengt:"+dimensions2.Length);
            Console.ReadKey();
        }
    }
}
